package com.epfly.promo.activity.impl;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;



@Data
@Configuration
@RefreshScope
public class ActivityPoolConfiguration {

    /**
     * 核心线程数，默认值2
     * @Value("${activity.pool.corePoolSize:#{null}")
     */
    @Value("${activity.pool.corePoolSize:2}")
    int corePoolSize = 2;

    /**
     * 最大线程数，默认值3
     */
    @Value("${activity.pool.maximumPoolSize:2}")
    int maximumPoolSize = 3;

    /**
     * 线程空闲时间，单位毫秒数，默认2秒
     */
    @Value("${activity.pool.keepAliveTime:2000}")
    long keepAliveTime = 2000;

    /**
     * 线程池有限队列大小
     */
    @Value("${activity.pool.queueSize:1000}")
    int queueSize = 1000;

    /**
     * 线程池队列预警阈值
     */
    @Value("${activity.pool.alertQueueSize:600}")
    int alertQueueSize = 600;

    /**
     * 每批次查询数量
     */
    @Value("${activity.pool.max.limit:200}")
    private int maxLimit = 200;

    /**
     * 最大执行次数
     */
    @Value("${activity.pool.max.exec.times:3}")
    private int maxExecuteTimes = 3;

}
